/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
/* eslint-disable prefer-spread */
/* eslint-disable @typescript-eslint/explicit-function-return-type */
export function redColorScaleGenerator(values) {
  const min = Math.min.apply(Math, values);
  const max = Math.max.apply(Math, values);
  return x => {
    const nonRed = 255 - Math.round((255 * (x - min)) / (max - min));
    return { backgroundColor: `rgb(255,${nonRed},${nonRed})` };
  };
}
